FILTER_CONFIG = [
    {
        "id": 1,
        "report_id": 1,
        "position": "select",
        "values": ["charge"]
    },
    {
        "id": 2,
        "report_id": 1,
        "position": "order by",
        "values": [["charge", "desc"], ["charge2", "asc"]]
    },
    {
        "id": 3,
        "report_id": 1,
        "position": "group by",
        "values": ["area", "sub_area"]
    },

    {
        "id": 5,
        "report_id": 1,
        "position": "where",
        "values": [["=", "area", 110000], ["between", "area", 110000, 120000], ["in", "area", 110000, 120000]]
    },
    {
        "id": 5,
        "report_id": 1,
        "position": "having",
        "values": [["=", "area", 110000], ["between", "area", 110000, 120000], ["in", "area", 110000, 120000]]
    },
]

REPORT_CONFIGS = [
    {
        "id": 1,
        "name": "保费占比",
        # "base_sql": " sum(charge) as charge from policy group by area",
        # "columns": [],
        "aggregations": [
            {
                "id": 1,
                "name": "保费占比聚合",
                "report_id": 1,
                "metric": {
                    "id": 1,
                    "name": "保费求和",
                    "sql": "sum(charge) from policy",
                    "conditions": [i if i["report_id"] == 1 else None for i in FILTER_CONFIG],
                }
            },
            {
                "id": 2,
                "name": "保费平均聚合",
                "report_id": 1,
                "metric": {
                    "id": 1,
                    "name": "保费求平均",
                    "sql": "avg(charge) as total_charge",
                },
                "conditions": [i if i["report_id"] == 1 else None for i in FILTER_CONFIG],
            },
        ],
        "conditions": [i if i["report_id"] == 1 else None for i in FILTER_CONFIG]
    }
]
